﻿using BruTile;

namespace EarthWatchers.SL.Layers
{
    public static class EsriWorldSchema
    {
        public static ITileSchema GetSchema()
        {
            var schema = new TileSchema();

            schema.Resolutions.Add(156543.033928);
            schema.Resolutions.Add(78271.5169639999);
            schema.Resolutions.Add(39135.7584820001);
            schema.Resolutions.Add(19567.8792409999);
            schema.Resolutions.Add(9783.93962049996);
            schema.Resolutions.Add(4891.96981024998);
            schema.Resolutions.Add(2445.98490512499);
            schema.Resolutions.Add(1222.99245256249);
            schema.Resolutions.Add(611.49622628138);
            schema.Resolutions.Add(305.748113140558);
            schema.Resolutions.Add(152.874056570411);
            schema.Resolutions.Add(76.4370282850732);
            schema.Resolutions.Add(38.2185141425366);
            schema.Resolutions.Add(19.1092570712683);
            schema.Resolutions.Add(9.55462853563415);
            schema.Resolutions.Add(4.77731426794937);
            schema.Resolutions.Add(2.38865713397468);
            schema.Resolutions.Add(1.19432856685505);
            schema.Resolutions.Add(0.597164283559817);
            schema.Resolutions.Add(0.298582141647617);

            schema.Height = 256;
            schema.Width = 256;
            schema.Extent = new Extent(-20037507.2295943, -19971868.8804086, 20037507.2295943, 19971868.8804086);
            schema.OriginX = -20037508.342787;
            schema.OriginY = 20037508.342787;
            schema.Name = "ESRI";
            schema.Format = "JPEG";
            schema.Axis = AxisDirection.InvertedY;
            schema.Srs = string.Format("EPSG:{0}", 102100);

            return schema;
        }
    }
}
